import router from "./router"

router.beforeEach(async (to, from, next) => {
  if (to.path === "/login") {
    next()
  } else {
    const token = sessionStorage.getItem("token")
    if (token) {
      next()
    } else {
      next(`/login`)
    }
  }
})
